package com.xy;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/18 20:31
 * @description
 */
public class Originator {
    private String state;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }


    /**
     * 保存状态
     */
    public Memento save() {
        return new Memento(getState());
    }

    /**
     * 恢复状态
     */
    public void resume(Memento memento) {
        state = memento.getState();
    }
}
